module.exports = {
  publicPath: process.env.VUE_APP_PUBLIC_PATH,
  chainWebpack: config => {
    config.plugin('define')
      .tap(args => {
        args[0]['process.env'].VUE_NODE_ENV = JSON.stringify(process.env.VUE_NODE_ENV);
        return args;
      });

    // 设置别名
    // config.resolve.alias
    // .set("@", resolve("src"))
    // .set("assets", resolve("src/assets"))
    // .set("components", resolve("src/components"));

    // config.module
    // .rule('images')
    // .use('image-webpack-loader')
    // .loader('image-webpack-loader')
    // .options({ bypassOnDebug: true })
    // .end();
  },
  css: {
    loaderOptions: {
      sass: {
        additionalData: `@import "~@/assets/variable.scss";`
      },
      scss: {
        additionalData: `@import "~@/assets/variable.scss";`
      }
      // less:{
      //   globalVars: {
      //     primary: '#fff'
      //   }
      // }
    } // Enable CSS modules for all css / pre-processor files. // This option does not affect *.vue files.
  },
  devServer: {
    proxy: {
      "/dz-im": {
        // target: "http://39.100.203.75:8996", // 源地址
        target: "https://testmall.dgzq.com.cn",
        changeOrigin: true, // 改变源
        pathRewrite: {
          // "^/dz-im": "" // 路径重写
        }
      }
    }
  }
};
